<?PHP
$PurviewLevel=0;
require("../../inc/common.inc.php");
require_once(dirname(__FILE__)."/../"."Admin_ChkPurview.php");
if(intval($pagetype)==0){$pagetype=2;}
$poststr = "&type=".$type."&pagetype=".$pagetype."&keyword=".$keyword."&rid=".$rid."&cid=".$cid;
$poststr2 = "&pagetype=".$pagetype."&rid=".$rid."&cid=".$cid;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../images/style.css" rel="stylesheet" type="text/css" />
<script>
var P = window.parent, D = P.loadinndlg();   // 注意！这行代码是每个内容页必须加的内容，否则无法正确显示。
</script>
</head>

<body>
<?php
if($action=="post"){
	if(intval($checkid)==0){
		echo '<script>alert("请先选择视频素材");history.go(-1);</script>';
		exit;
	}else{
		$sucaiinfo = $db->getinfo("select * from mx_sucai_file where fid='".$checkid."' limit 1");
		if($sucaiinfo){
			echo '<script>window.top.main.showinfo("'.$returnid.'","'.$changeid.'","'.$checkid.'");P.cancel();</script>';
			exit;
		}else{
			echo '<script>alert("参数错误");history.go(-1);</script>';
			exit;
		}
	}
}
?>
<div class="xm2_b">
			
			<div class="t">
				<div style=" float:right; padding:5px; padding-right:10px; font-weight:bold;">快速检索: <input name="keyword" type="text" value="<?php echo $keyword;?>" onkeydown="setTrack(this,event)" /></div>
				<div class="clear"></div>
			</div>
				<script type="text/javascript" src="../js/jquerys-1.5.1.js"></script>
                <script language="javascript">
				function setTrack(tt,event){
				var e = event?event:window.event
				if(e.keyCode == 13){
				window.location="tuisong_video_list.php?type=title<?php echo $poststr2;?>&keyword="+tt.value;
				}
				}
				</script>
				<script language="javascript">
				$(document).ready(function(){ //这个就是传说的ready   
				$(".stripe tr").mouseover(function(){   
				//如果鼠标移到class为stripe的表格的tr上时，执行函数   
				$(this).addClass("over");}).mouseout(function(){   
				//给这行添加class值为over，并且当鼠标一出该行时执行函数   
				$(this).removeClass("over");}) //移除该行的class   
				$(".stripe tr:even").addClass("alt");   
				//给class为stripe的表格的偶数行添加class值为alt
				//www.divcss5.com 整理特效
				});   
				function selectradio(radioid){
					document.getElementById("checkid"+radioid).checked="checked";
				}
				function checkselete(){
					var itemradio = document.getElementsByName("checkid"); 
					var itemvalue = ''; 
					 for(i=0;i<itemradio.length;i++){
						if(itemradio[i].checked){   
						 itemvalue = itemradio[i].value; 
						}
					 }
					 if( itemvalue =="" ){
					  alert('请先选择视频素材');
					  return false;
					 }
				}
				</script> 
                
               <form name="form1" action="tuisong_video_list.php?action=post<?php echo $poststr;?>" method="post" onsubmit="return checkselete()">
               <input type="hidden" name="returnid" value="<?php echo $rid;?>">
               <input type="hidden" name="changeid" value="<?php echo $cid;?>"> 
			<table width="98%" border="0" align="center" cellpadding="9" cellspacing="1" bgcolor="#CCCCCC" class="stripe">
			  <tr>
				<th width="10%" align="center" ></th>
                <th align="center" class="table_ti">素材名称</th>
                <th width="10%" align="center" class="table_ti">大小</th>
                <th width="20%" align="center" class="table_ti">添加时间</th>
			  </tr>
              <?php
			  if(empty($pageindex)){$pageindex=1;}
			  $str=" and ftype=4";
			  if($type=="yz"){
				  $str.=" AND isok=1 ";
			  }
			  elseif($type=="unyz"){
				  $str.=" AND isok=0 ";
			  }
			  elseif($type=="title"){
				  $str.=" AND fname LIKE '%$keyword%' ";
			  }
			  $order="order by addtime desc, fid desc";
			  $pagesize = $pagetype==1?"10":"5";
			  $table=" mx_sucai_file ";
			  $column=" * ";
			  $c=$db->listcount($table,$str);
			  $list=$db->list1($pageindex,$pagesize,$table,$column,$str,$order);
			  if(!is_array($list) or $c==0){
				echo "<tr><td colspan='10'><p style='height:30px;text-align:center;line-height:30px;'>暂无信息</p></td></tr>";
			  }
			  else{
			  for($i=0;$i<count($list);$i++){
			  ?>
			  <tr onclick="selectradio(<?php echo $list[$i]["fid"];?>)">
				<td align="center" bgcolor="#FFFFFF"><input type="radio" name="checkid" id="checkid<?php echo $list[$i]["fid"];?>" value="<?php echo $list[$i]["fid"];?>" class="ri" /></td>
				<!--<td align="center" bgcolor="#FFFFFF" class="font14"><?php echo $list[$i]["fid"];?></td>-->
				<td align="center" bgcolor="#FFFFFF" class="font14"><?php echo $list[$i]["fname"];?></td>
                <td align="center" bgcolor="#FFFFFF" class="font14"><?php echo round($list[$i]["fsize"]/1024,2);?>k</td>
				<td align="center" bgcolor="#FFFFFF" class="font12"><?php echo date("Y-m-d",$list[$i]["addtime"])?></td>
			  </tr>
              
			  <?php
			  }
			  }
			  ?>
			</table>
            
			<div class="height15"></div>
			<div class="pagination">
				<?php if ($c>$pagesize){echo $db->ThePage_mxsoft($s,$pageindex,$c,$pagesize,'','',0,4,''.$poststr.'');}?>
			</div>
            <div class="clear"></div>
            <div style="height:30px; text-align:center;"><input type="submit" class="button" name="button" id="button" value="完成" />&nbsp;&nbsp;<input type="button" class="button2" name="button2" id="button2" value="上传" onclick="window.top.main.location='/mxsoft/sucai/sucai_video.php'" /></div>
			<div class="height15"></div>
            </form>
		</div>
</body>
</html>